/**************************************************************************
 *
 *                Admin Over IM
 *
 **************************************************************************
 *  <Copyright>
 *    Copyright (C) 2008  Basov Alexander
 *
 *  <Unit> iq.h
 *    <Purpose>
 *    <Effects>
 *    <Perfomance>
 **************************************************************************
 *  $Revision: 136 $ $Author: coopht $
 *  $Date: 2008-03-17 19:27:38 +0000 (Mon, 17 Mar 2008) $
 **************************************************************************/
#ifndef __IQ_H_
#define __IQ_H_

#include <string>

using std::string;

enum IQ_TYPE {GET, SET, RESULT, ERROR};
enum IQ_META_NAME 
{
  IQ_BASE,
  IQ_GET,
  IQ_SET,
  IQ_RESULT,
  IQ_ERROR,
  IQ_AUTH_REQUEST,
  IQ_AUTH_RESULT,  
  IQ_VERSION_REQUEST,
  IQ_SERVICE_DISCOVERY_REQUEST,
};

class IQ
{
public:
  IQ (IQ_TYPE _type,
      const string _id = "", 
      const string _from = "",
      const string _to = "");  

  inline IQ_TYPE getType () {return this->type;} 
  const string getTypeStr ();
  void setTypeStr (const string val);

  inline const string getId () {return this->id;}
  inline void setId (const string _id) {this->id = _id;}

  inline const string getToJID () {return this->toJID;}
  inline void setToJID (const string _toJID) {this->toJID = _toJID;}

  inline const string getFromJID () {return this->fromJID;};
  inline void setFromJID (const string _fromJID) {this->fromJID = _fromJID;}

  virtual const string toXmlStr () = 0;
  virtual IQ_META_NAME className () = 0 ;

private:
  IQ_TYPE type;  
  string id;
  string toJID;
  string fromJID;
};

class IQGet: public IQ
{
public:
  IQGet (const string _id, 
	 const string _from,
	 const string _to)
    : IQ (GET, _id, _from, _to) {};  

  const string toXmlStr () {return "";};
  IQ_META_NAME className () {return IQ_GET;} ;
};

class IQSet: public IQ
{
public:
  IQSet(const string _id,
	const string _from,
	const string _to):IQ(SET, _id, _from, _to) {};

  const string toXmlStr () {return "";};
  IQ_META_NAME className () {return IQ_SET;} ;
};

class IQResult: public IQ
{
public:
  IQResult (const string _id, 
	    const string _from)
    :IQ(RESULT, _id, _from) {};

  const string toXmlStr () {return "";};
  IQ_META_NAME className () {return IQ_RESULT;} ;

};

class IQError: public IQ
{
public:
  IQError(const string _id):IQ(ERROR, _id) {};

  const string toXmlStr () {return "";};
  IQ_META_NAME className () {return IQ_ERROR;} ;
};

// class IQAuthRequest

class IQAuthRequest: public IQSet
{
public:
  IQAuthRequest (const string _iq = "", 
		 const string _from = "",
		 const string _to = "")
    :IQSet (_iq, _from, _to) {};

  inline void setUserName (const string un)  {this->userName = un;}
  inline void setPassword (const string pwd) {this->password = pwd;}
  
  inline const string getUserName () {return this->userName;}  
  inline const string getPassword () {return this->password;}

  inline const string getResource () {return this->resource;}  
  inline void setResource (const string res) {this->resource = res;}
  
  const string toXmlStr ();
  IQ_META_NAME className () {return IQ_AUTH_REQUEST;};

private:
  string userName;
  string password;
  string resource;
};

// class IQAuthResult

class IQAuthResult: public IQ
{
public:
  IQAuthResult (IQ_TYPE type, const string _id):IQ (type, _id) {};
  const string toXmlStr () {return "";}
  IQ_META_NAME className () {return IQ_AUTH_RESULT;}
};

// class IQVersionRequest

class IQVersionRequest: public IQGet
{
public:
  IQVersionRequest (const string _id, 
		    const string _from,
		    const string _to)
    : IQGet (_id, _from, _to) {};  

  const string toXmlStr () {return "";};
  IQ_META_NAME className () {return IQ_VERSION_REQUEST;};
};

// class Service Discovery XEP-0030

class IQServiceDiscoveryRequest: public IQGet
{
public:
  IQServiceDiscoveryRequest (const string _id, 
			     const string _from,
			     const string _to)
    : IQGet (_id, _from, _to) {};

  const string toXmlStr () {return "";};
  IQ_META_NAME className () {return IQ_SERVICE_DISCOVERY_REQUEST;};
};

	     
#endif //__IQ_H_

